<template>
    <div style="height:100vh;height:100%;background-color:#f4f7fa ">
        <div style="position:relative">
            <div style="margin-top:10px;padding-top:10px">
                <el-steps :active="1" align-center>
                    <el-step title="填写货转申请"></el-step>
                    <el-step title="审核货转申请"></el-step>
                    <el-step title="创建货转计划"></el-step>
                    <el-step title="货转中"></el-step>
                    <el-step title="货转完成"></el-step>
                </el-steps>
            </div>
            <el-button type="primary" size="mini" style="margin: 20px 0 0 30px" :loading="saveLoading" @click="cretedInfoDtail(0)">保存
            </el-button>
            <el-button type="primary" size="mini" style="margin: 20px 0 0 10px" :loading="saveLoading" @click="cretedInfoDtail(1)">保存并提交
            </el-button>
            <el-button type="primary" @click="onIsShows" size="mini"
                       style="position: absolute;right:10px;margin: 20px 30px 0 0">返回
            </el-button>
            <Card style="margin:7px 30px 20px">
                <Form :label-width="130" ref="formValidate" :model="goodsTransferInfo" :rules="ruleValidate">
                    <Row style="padding-left: 4px">
                        <i-col :span="7">
                            <FormItem label="仓库" prop="whName">
                                <Input style="font-weight: 700; font-size: 13px;" v-model="goodsTransferInfo.whName"
                                       disabled></Input>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="货主" prop="customer">
                                <i-select
                                    v-if="$utils.getUserInfo().currentAgentPermission"
                                    :value="cargoOwner.customerCode"
                                    filterable
                                    @on-change="onChangeCustomer"
                                >
                                    <i-option
                                        v-for="item in $utils.getUserInfo().customerInfoList || []"
                                        :key="item.customerPartyID"
                                        :value="item.customerPartyCode"
                                        :label="item.customerPartyName"
                                    ></i-option>
                                </i-select>
                                <Input v-else style="font-weight: 700; font-size: 13px;" v-model="goodsTransferInfo.customer"
                                       disabled></Input>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="新货主" prop="customerNew">
                                <Input style="font-weight: 700; font-size: 13px;"
                                       v-model="goodsTransferInfo.customerNew"></Input>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="新结算客户" prop="settlementCustomerNew">
                                <Input style="font-weight: 700; font-size: 13px;"
                                       v-model="goodsTransferInfo.settlementCustomerNew"></Input>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="货转当天堆存费" prop="storageFee">
                                <Select style="font-weight: 700; font-size: 13px;"
                                        v-model="goodsTransferInfo.storageFee">
                                    <Option
                                        v-for="item in storageFee"
                                        :key="item.id"
                                        :label="item.label"
                                        :value="item.value">
                                    </Option>
                                </Select>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="货转日期" prop="changeTime">
                                <DatePicker style="font-weight: 700; font-size: 13px; width: 100%"
                                            v-model="goodsTransferInfo.changeTime"></DatePicker>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="备注">
                                <Input style="font-weight: 700; font-size: 13px;"
                                       v-model="goodsTransferInfo.remark"></Input>
                            </FormItem>
                        </i-col>
                        <i-col :span="7">
                            <FormItem label="出库密钥">
                                <Checkbox style="font-weight: 700; font-size: 13px;"
                                          v-model="goodsTransferInfo.authenticateFlag" true-value="1"
                                          false-value="0"></Checkbox>
                            </FormItem>
                        </i-col>
                    </Row>
                </Form>
<!--                <el-button type="primary" size="mini" style="margin: 20px 0 0 30px" @click="addGoodsTransferInfo">新增-->
<!--                </el-button>-->
                <Modal
                    v-model="goodsTransferPlanInfoShow"
                    title="新增货转"
                    width="80%"
                    height="70%"
                    @on-ok="goodsInformation"
                    @on-cancel="godsInformationClose">
                    <div style="margin-bottom:10px">
                        <p style="font-weight: 700; font-size: 14px;">备选货物</p>
                        <el-table
                            height="300"
                            style="width: 100%;font-size:12px"
                            :header-cell-style="{'font-weight': 300,'color': '#111',background:'rgb(242,245,249)',padding: '3px'}"
                            :data="searchInfo">
                            <el-table-column
                                type="index"
                                label="序号"
                                align="center"
                                width="60">
                            </el-table-column>
                            <el-table-column
                                v-for="item in tableData.AddColumnsList"
                                :key="item.prop"
                                :prop="item.prop"
                                :label="item.label"
                                :width="item.width"
                                :formatter="item.formatter"
                                align="center"
                                :fixed="item.fixed">
                                <el-table-column :width="item.width" v-if="item.type" :prop="item.prop" align="center"
                                                 :formatter="item.formatter">
                                    <template slot="header" slot-scope="{}">
                                        <Input
                                            v-if="item.prop === 'batchAttr07'"
                                            v-model="searchTableData['batchAttr07']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <Input
                                            v-if="item.prop === 'matName'"
                                            v-model="searchTableData['matName']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <Input
                                            v-if="item.prop === 'country' || item.prop === 'countryName'"
                                            v-model="searchTableData['country']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <Input
                                            v-if="item.prop === 'factoryCode'"
                                            v-model="searchTableData['factoryCode']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <Input
                                            v-if="item.prop === 'batchAttr08'"
                                            v-model="searchTableData['batchAttr08']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <Input
                                            v-if="($route.query.menuActiveName == 26||$route.query.menuActiveName == 37) ? item.prop === 'isBulkCargo' : ''"
                                            v-model="searchTableData['isBulkCargo']"
                                            placeholder="输入关键字搜索"
                                            @on-enter="selectStockDataList"/>
                                        <el-select clearable v-model="searchTableData['matTypCode']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'matTypName'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in categoryList"
                                                :key="item.id"
                                                :label="item.dictName"
                                                :value="item.dictValue">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['whName']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'whName'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in whList"
                                                :key="item.id"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['mscAuthentication']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'mscAuthentication'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in mscAuthenticationList"
                                                :key="item.id"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['groupName']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'groupName'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in allStgData"
                                                :key="item.id"
                                                :label="item.stgTypText"
                                                :value="item.stgTypCode">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['goodsBondedProperty']"
                                                    :popper-append-to-body="false"
                                                    size="mini" placeholder="" v-if="item.prop === 'goodsBondedProperty'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in goodsBondedPropertyList"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['supervisionStatus']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'supervisionStatus'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in supervisionStatusList"
                                                :key="item.id"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['productStatus']" size="mini"
                                                    :popper-append-to-body="false"
                                                    placeholder="" v-if="item.prop === 'productStatus'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in productStatusSelectList"
                                                :key="item.id"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select clearable v-model="searchTableData['settlementCustomerName']"
                                                    :popper-append-to-body="false"
                                                    value="" size="mini" placeholder=""
                                                    v-if="item.prop === 'settlementCustomerName'"
                                                    @change="selectStockDataList">
                                            <el-option
                                                v-for="item in allOwner"
                                                :key="item.id"
                                                :label="item.settlementCustomerName"
                                                :value="item.settlementCustomer">
                                            </el-option>
                                        </el-select>
                                        <DatePicker placeholder="请选择" transfer type="daterange" split-panels
                                                    v-if="item.prop == 'dateInto'" style="width:240px"
                                                    v-model="searchTableData['dateInto']"
                                                    @on-change="selectStockDataList"></DatePicker>
                                        <DatePicker placeholder="请选择" transfer type="date" split-panels
                                                    v-if="item.prop == 'dateGen'" style="width:140px"
                                                    v-model="searchTableData['dateGen']"
                                                    @on-change="selectStockDataList"></DatePicker>
                                        <DatePicker placeholder="请选择" transfer type="date" split-panels
                                                    v-if="item.prop == 'dateExpire'" style="width:140px"
                                                    v-model="searchTableData['dateExpire']"
                                                    @on-change="selectStockDataList"></DatePicker>
                                    </template>
                                </el-table-column>
                            </el-table-column>
                            <!-- <el-table-column label="可出库数量" fixed="right" prop="availableQty" width="100">
                            </el-table-column> -->
                            <el-table-column label="操作" fixed="right" width="100" align="center">
                                <template slot-scope="scope">
                                    <el-button
                                        v-if="scope.row['availableQty'] > 0"
                                        size="mini" type="text"
                                        @click.native.prevent="addHandler(scope.$index, scope.row)">
                                        <div style="color:#5c68ee;text-align:center">添加</div>
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <Page style="margin-top:10px" size="small" :total="total" show-elevator show-sizer
                              @on-change="Pagechange" @on-page-size-change="pageSizeChange" :page-size="pageSize" :current="page"></Page>
                    </div>
                    <div>
                        <p style="font-weight: 700; font-size: 14px;">已选货物</p>
                        <el-table
                            :data="selectInfo"
                            height="250"
                            style="width: 100%;font-size:12px"
                            :header-cell-style="{'font-weight': 300,'color': '#111',background:'rgb(242,245,249)',padding: '5px'}">
                            <el-table-column
                                type="index"
                                label="序号"
                                width="60">
                            </el-table-column>
                            <el-table-column v-for="item in tableData.AddColumns"
                                             :key="item.prop"
                                             :prop="item.prop"
                                             :width="item.width"
                                             :label="item.label"
                                             :fixed="item.fixed"
                                             align="center"
                            >
                                <template slot-scope="scope">
                                    <el-input
                                        v-if="item.prop == 'availableQty'"
                                        v-model="scope.row[item.prop]"
                                        size="mini"
                                        placeholder="输入关键字"
                                        @change="getGoodsTransfer(scope.row)"
                                    />
                                    <el-input
                                        v-else-if="item.prop == 'availableWeight'"
                                        v-model="scope.row[item.prop]"
                                        size="mini"
                                        placeholder="输入关键字"
                                        disabled/>
                                    <div v-if="item.prop == 'productStatus'">
                                        {{ scope.row[item.prop] == 1 ? '正品' : scope.row[item.prop] == 2 ? '不良品' : scope.row[item.prop] == 4 ? '破箱' : '' }}
                                    </div>
                                    <div v-if="item.prop == 'qualityStatus'">
                                        {{ scope.row[item.prop] == 'F' ? '合格' : '不合格' }}
                                    </div>
                                    <div v-if="item.prop == 'goodsBondedProperty'">
                                        {{ scope.row[item.prop] == '0' ? '保税' : '一般贸易' }}
                                    </div>
                                    <div v-if="item.prop == 'mscAuthentication'">
                                        {{ scope.row[item.prop] == '0' ? '否' : '是' }}
                                    </div>
                                    <div v-if="item.prop == 'supervisionStatus'">
                                        {{ scope.row[item.prop] == 0 ? '未质押' : '已质押' }}
                                    </div>
                                    <div
                                        v-if="item.prop != 'mscAuthentication' && item.prop != 'goodsBondedProperty' && item.prop != 'availableWeight' && item.prop != 'availableQty' && item.porp != 'totalQty' && item.prop != 'sumMatWeight' && item.prop != 'productStatus' && item.prop != 'qualityStatus' && item.prop !='supervisionStatus'">
                                        {{ scope.row[item.prop] }}
                                    </div>
                                </template>
                            </el-table-column>
                            <!-- <el-table-column label="出库数量" fixed="right" prop="totalQty" width="100" align="center">
                                <InputNumber v-model="outQty" min="0"></InputNumber>
                            </el-table-column> -->
                            <el-table-column fixed="right" width="100" label="操作" align="center">
                                <template slot-scope="scope">
                                    <el-button type="text" size="mini"
                                               @click.native.prevent="selectInfoDelete(scope.$index, scope.row)">
                                        <div style="color:#5c68ee;text-align:center">删除</div>
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </Modal>
                <div>
                    <el-table
                        min-height="210"
                        style="width: 100%;font-size:12px;margin-top:20px"
                        :header-cell-style="{'font-weight': 300,'color': '#111',background:'rgb(242,245,249)'}"
                        :data="tableDataList">
                        <el-table-column
                            type="index"
                            label="序号"
                            min-width="4%">
                        </el-table-column>
                        <el-table-column v-for="item in tableData.tableDataListColumns"
                                         :key="item.prop"
                                         :prop="item.prop"
                                         min-width="9%"
                                         :label="item.label"
                                         :formatter="item.formatter"
                                         align="center"
                        >
                            <template slot-scope="scope">
                                <el-input
                                    v-if="item.prop == 'settlementCustomer'"
                                    v-model="scope.row[item.prop]"
                                    size="mini"
                                    placeholder="输入关键字"/>
                                <el-input
                                    v-else-if="item.prop == 'availableQty'"
                                    v-model="scope.row[item.prop]"
                                    size="mini"
                                    placeholder="输入关键字"
                                    disabled
                                    @change="getGoodsTransfer(scope.row)"/>
                                <el-input
                                    v-else-if="item.prop == 'availableWeight'"
                                    v-model="scope.row[item.prop]"
                                    size="mini"
                                    placeholder="输入关键字"
                                    disabled/>
                                <div v-if="item.prop == 'productStatus'">
                                    {{ scope.row[item.prop] == 1 ? '正品' : scope.row[item.prop] == 2 ? '不良品' : scope.row[item.prop] == 4 ? '破箱' : '' }}
                                </div>
                                <div v-if="item.prop == 'qualityStatus'">{{
                                        scope.row[item.prop] == 'F' ? '合格' : '不合格'
                                    }}
                                </div>
                                <div
                                    v-if="item.prop != 'productStatus' && item.prop != 'availableQty' && item.prop != 'availableWeight' && item.prop != 'settlementCustomer' && item.prop != 'qualityStatus'">
                                    {{ scope.row[item.prop] }}
                                </div>
                            </template>
                        </el-table-column>
<!--                        <el-table-column label="操作" fixed="right" width="100">-->
<!--                            <template slot-scope="scope">-->
<!--                                <el-button type="text" size="mini"-->
<!--                                           @click.native.prevent="delectInfo(scope.$index, scope.row)">-->
<!--                                    <div style="color:#5c68ee;text-align:center">删除</div>-->
<!--                                </el-button>-->
<!--                            </template>-->
<!--                        </el-table-column>-->
                    </el-table>
                </div>
            </Card>
            <Card style="margin:7px 30px 20px">
                <attachment-model ref="attachmentRef" :url="`/api/wms_file/customerUpload`" :select-row.sync="selectRow" :menu-active-name="menuActiveName" :wms-url="wmsUrl" @check-data="checkData" @refresh-file-list="refreshFileList"/>
            </Card>
        </div>
    </div>
</template>

<script>
import {
    getStockListByOwnerCodeForLenglian,
    getAllStgData,
    getCategoryInfo,
    getOwnerCodeListByStock,
    getGoodsTransfer,
    addProp,
    editProp,
    submitProp,
    selectCustomerInfoByDto
} from '@/api/planInfo.js'
import baseCodeApi from '@/api/baseCode';
import _ from 'lodash'
import AttachmentModel from '@/view/component/attachment/index.vue'

export default {
    components: {
        AttachmentModel
    },
    props: {
        menuActiveName: {
            type: Number,
            default: null
        },
        wmsUrl: {
            type: String,
            default: ''
        },
        wareList: {
            type: Array,
            default: () => []
        },
        list: {
            type: Array,
            default: () => []
        },
        item: {
            type: Object,
            default: () => {
            }
        },
        ccisCustomerCode: {
            type: String,
            default: ""
        }
    },
    data() {
        return {
            complete: new Promise((resolve, reject) => {
                this.resolveComplete = resolve;
                this.rejectComplete = reject;
            }),
            saveLoading: false,
            ruleValidate: {
                whName: [
                    {required: true, message: '仓库不能为空', trigger: 'blur'}
                ],
                customer: [
                    {required: true, message: '货主不能为空', trigger: 'blur'},
                ],
                customerNew: [
                    {required: true, message: '新货主不能为空', trigger: 'blur'}
                ],
                changeTime: [
                    {required: true, type: 'date', message: '货转日期不能为空', trigger: 'change'}
                ],
                settlementCustomerNew: [
                    {required: true, message: '新结算客户不能为空', trigger: 'blur'}
                ],
                storageFee: [
                    {required: true, message: '货转当天堆存费不能为空', trigger: 'blur'}
                ]
            },
            activeName: 'alternativeGoods',
            activeName1: 'selectedGoods',
            outQty: '',
            goodsTransferInfo: {
                whName: '',
                customer: '',
                customerNew: '',
                authenticateFlag: false,
                remark: '',
                changeTime: '',
                storageFee: '',
                settlementCustomerNew: ''
            },
            searchTableData: {
                filterValue: '',
                stgTypCode: '',
                batchAttr07: '',
                matName: '',
                matTypCode: '',
                mscAuthentication: '',
                goodsBondedProperty: '',
                supervisionStatus: '',
                wmsBatchNum: '',
                productStatus: '',
                dateInto: [],
                dateGen: '',
                dateExpire: '',
                settlementCustomerName: '',
                batchAttr08: ''
            },
            searchInfo: [],
            selectInfo: [],
            goodsTransferPlanInfoShow: false,
            tableData: {
                AddColumnsList: [{
                    prop: 'batchAttr07',
                    label: '箱号',
                    width: '120',
                    type: 'input'
                }, {
                    prop: 'matName',
                    label: '品名',
                    type: 'input',
                    width: '140'
                }, {
                    prop: 'matTypName',
                    label: '品类',
                    type: 'select',
                    width: '140'
                }, {
                    prop: (this.$route.query.menuActiveName == 26 || this.$route.query.menuActiveName == 37)? 'isBulkCargo' : '',
                    label: '规格',
                    type: 'input',
                    width: '140'
                }, {
                    prop: this.$route.query.menuActiveName == 36 ? 'countryName' : 'country',
                    label: '国别',
                    type: 'input',
                    width: '140'
                }, {
                    prop: 'factoryCode',
                    label: '厂号',
                    width: '180',
                    type: 'input'
                }, {
                    prop: 'batchAttr08',
                    label: '提单号',
                    width: '160',
                    type: 'input'
                }, {
                    prop: 'goodsBondedProperty',
                    label: '保税性质',
                    type: 'select',
                    width: '140',
                    formatter: (row) => {
                        if (row.goodsBondedProperty == 2) {
                            return '保税'
                        } else {
                            return '一般贸易'
                        }
                    }
                }, {
                    prop: 'supervisionStatus',
                    label: '质押状态',
                    type: 'select',
                    width: '140',
                    formatter: (row) => {
                        if (row.supervisionStatus == 0) {
                            return '未质押'
                        } else {
                            return '已质押'
                        }
                    }
                },
                    {
                        prop: 'dateGen',
                        label: '生产日期',
                        width: '170',
                        type: 'date'
                    }, {
                        prop: 'dateExpire',
                        label: '失效日期',
                        width: '170',
                        type: 'date'
                    },
                    {
                        prop: 'dateInto',
                        label: '入库时间',
                        width: '250',
                        type: 'date'
                    },
                    {
                        prop: 'settlementCustomerName',
                        label: '结算客户',
                        width: '200',
                        type: 'select'
                    }, {
                        prop: 'availableQty',
                        label: '货转件数',
                        width: '120',
                        fixed: 'right'
                    }, {
                        prop: 'availableWeight',
                        label: '货转重量(KGS)',
                        width: '120',
                        fixed: 'right'
                    }],
                AddColumns: [{
                    prop: 'batchAttr07',
                    label: '箱号',
                    width: '120',
                    type: 'input'
                }, {
                    prop: 'matName',
                    label: '品名',
                    type: 'input',
                    width: '140'
                }, {
                    prop: 'matTypName',
                    label: '品类',
                    type: 'select',
                    width: '140'
                }, {
                    prop: this.$route.query.menuActiveName == 36 ? 'countryName' :'country',
                    label: '国别',
                    type: 'input',
                    width: '140'
                }, {
                    prop: 'factoryCode',
                    label: '厂号',
                    width: '180',
                    type: 'input'
                }, {
                    prop: 'batchAttr08',
                    label: '提单号',
                    width: '160',
                    type: 'input'
                }, {
                    prop: 'goodsBondedProperty',
                    label: '保税性质',
                    type: 'select',
                    width: '140',
                    formatter: (row) => {
                        if (row.goodsBondedProperty == 2) {
                            return '保税'
                        } else {
                            return '一般贸易'
                        }
                    }
                }, {
                    prop: 'supervisionStatus',
                    label: '质押状态',
                    type: 'select',
                    width: '140',
                    formatter: (row) => {
                        if (row.supervisionStatus == 0) {
                            return '未质押'
                        } else {
                            return '已质押'
                        }
                    }
                },
                    {
                        prop: 'dateGen',
                        label: '生产日期',
                        width: '170',
                        type: 'date'
                    }, {
                        prop: 'dateExpire',
                        label: '失效日期',
                        width: '170',
                        type: 'date'
                    },
                    {
                        prop: 'dateInto',
                        label: '入库时间',
                        width: '250',
                        type: 'date'
                    },
                    {
                        prop: 'settlementCustomerName',
                        label: '结算客户',
                        width: '200',
                        type: 'select'
                    }, {
                        prop: 'availableQty',
                        label: '货转件数',
                        width: '120',
                        fixed: 'right'
                    }, {
                        prop: 'availableWeight',
                        label: '货转重量(KGS)',
                        width: '120',
                        fixed: 'right'
                    }],
                tableDataListColumnsTC: [{
                    prop: 'batchAttr07',
                    label: '箱号',
                    width: '120'
                }, {
                    prop: 'settlementCustomerName',
                    label: '结算客户',
                    width: '120'
                }, {
                    prop: 'matName',
                    label: '品名',
                    width: '120'
                }, {
                    prop: 'matTypName',
                    label: '品类',
                    width: '120'
                }, {
                    prop: 'batchAttr08',
                    label: '提单号',
                    width: '120'
                }, {
                    prop: 'dateGen',
                    label: '生产日期',
                    width: '120'
                }, {
                    prop: 'dateExpire',
                    label: '失效日期',
                    width: '120'
                }, {
                    prop: 'batchAttr12',
                    label: '报关单号',
                    width: '120'
                }, {
                    prop: 'batchAttr14',
                    label: '船名',
                    width: '120'
                }, {
                    prop: 'batchAttr16',
                    label: '航次',
                    width: '120'
                }, {
                    prop: 'wmsBatchNum',
                    label: '批次号',
                    width: '120'
                }, {
                    prop: 'orderWeight',
                    label: '总重量(KGS)',
                    width: '120'
                }, {
                    prop: 'totalQty',
                    label: '总件数',
                    width: '120'
                }, {
                    prop: 'availableQty',
                    label: '货转件数',
                    width: '120'
                }, {
                    prop: 'availableWeight',
                    label: '货转重量(KGS)',
                    width: '120'
                }],
                tableDataListColumnsSH: [{
                    prop: 'batchAttr07',
                    label: '箱号',
                    // width: '120'
                }, {
                    prop: 'settlementCustomerName',
                    label: '结算客户',
                    width: '140'
                }, {
                    prop: 'matName',
                    label: '品名',
                    // width: '120'
                }, {
                    prop: 'matTypName',
                    label: '品类',
                    // width: '120'
                }, {
                    prop: 'batchAttr08',
                    label: '提单号',
                    width: '120'
                }, {
                    prop: 'dateGen',
                    label: '生产日期',
                    // width: '120'
                }, {
                    prop: 'dateExpire',
                    label: '失效日期',
                    // width: '120'
                }, {
                    prop: 'orderWeight',
                    label: '总重量(KGS)',
                    width: '120'
                }, {
                    prop: 'totalQty',
                    label: '总件数',
                    width: '120'
                }, {
                    prop: 'availableQty',
                    label: '货转件数',
                    width: '120'
                }, {
                    prop: 'availableWeight',
                    label: '货转重量(KGS)',
                    width: '120'
                }],
                tableDataListColumnsTJ: [{
                    prop: 'batchAttr07',
                    label: '箱号',
                    width: '120'
                }, {
                    prop: 'settlementCustomerName',
                    label: '结算客户',
                    width: '240'
                }, {
                    prop: 'matName',
                    label: '品名',
                    width: '120'
                }, {
                    prop: 'matTypName',
                    label: '品类',
                    width: '120'
                }, {
                    prop: 'batchAttr08',
                    label: '提单号',
                    width: '120'
                }, {
                    prop: 'dateGen',
                    label: '生产日期',
                    width: '120'
                }, {
                    prop: 'dateExpire',
                    label: '失效日期',
                    width: '120'
                }, {
                    prop: 'orderWeight',
                    label: '总重量(KGS)',
                    width: '120'
                }, {
                    prop: 'totalQty',
                    label: '总件数',
                    width: '120'
                }, {
                    prop: 'availableQty',
                    label: '货转件数',
                    width: '120',
                    type: 'input'
                }, {
                    prop: 'availableWeight',
                    label: '货转重量(KGS)',
                    width: '120',
                    type: 'input'
                }],
                tableDataListColumns: []
            },
            tableDataList: [],
            total: 0,
            page: 1,
            pageSize: 10,
            mscAuthenticationList: [
                {label: '是', value: 1},
                {label: '否', value: 0}
            ],
            goodsBondedPropertyList: [
                {label: '一般贸易', value: 1},
                {label: '保税', value: 2}
            ],
            supervisionStatusList: [
                {label: '已质押', value: 1},
                {label: '未质押', value: 0}
            ],
            productStatusSelectList: [
                {label: '正品', value: 1},
                {label: '不良品', value: 2},
                {label: '退货正品', value: 3},
                {label: '破箱', value: 4}
            ],
            allOwner: [],
            storageFee: [{
                label: '新结算客户',
                value: '1'
            }, {
                label: '原结算客户',
                value: '0'
            }],
            cargoOwner: {},
            dictInfo: {},
            categoryList: [],
            selectRow: null,
            wmsCustomerCode: ''
        }
    },
    methods: {
        resolveComplete() {},
        rejectComplete() {},

        selectWMSCustomerInfo() {
            return new Promise((resolve, reject) => {
                if (!this.cargoOwner.customerCode) {
                    this.$Message.warning('请选择货主');
                    reject();
                }
                selectCustomerInfoByDto({ ccisCustomerCode: this.cargoOwner.customerCode }, this.$props.wmsUrl)
                    .then(response => {
                        const { returnCode, returnData } = response.data;
                        if (returnCode === 200 && returnData.length === 1) {
                            resolve(returnData[0].customerCode);
                        } else {
                            reject();
                        }
                    })
                    .catch(error => {
                        console.log('selectWMSCustomerInfo', error);
                        this.$Message.error('网络错误！请重试');
                        reject();
                    })
            })
        },
        addGoodsTransferInfo() {
            this.searchTableData =  {
                filterValue: '',
                stgTypCode: '',
                batchAttr07: '',
                matName: '',
                matTypCode: '',
                mscAuthentication: '',
                goodsBondedProperty: '',
                supervisionStatus: '',
                wmsBatchNum: '',
                productStatus: '',
                dateInto: [],
                dateGen: '',
                dateExpire: '',
                settlementCustomerName: '',
                batchAttr08: ''
            },
            this.goodsTransferPlanInfoShow = true;
            this.selectInfo = _.cloneDeep(this.tableDataList);

            this.$nextTick(() => {
                this.selectStockDataList()
            })
        },
        cretedInfoDtail(item) {
            if (this.goodsTransferInfo.customerNew == '') {
                this.$Message.warning('新货主不能为空');
                return;
            }
            if (this.goodsTransferInfo.settlementCustomerNew == '') {
                this.$Message.warning('新结算客户不能为空');
                return;
            }
            if (this.goodsTransferInfo.storageFee == '') {
                this.$Message.warning('请选择货转当天堆存费');
                return;
            }
            if (this.goodsTransferInfo.changeTime == '') {
                this.$Message.warning('请选择货转日期');
                return;
            }
            let body = {list: []};
            this.tableDataList.forEach((item, index) => {
                body.list.push({
                    detailStr: JSON.stringify(this.selectInfo[index]),
                    whCode: this.wareList.filter(item => item.id == this.$props.menuActiveName)[0].whCode,
                    customerCode: this.cargoOwner.customerCode,
                    customer: this.cargoOwner.dictName,
                    settlementCustomerNew: this.goodsTransferInfo.settlementCustomerNew,
                    customerNew: this.goodsTransferInfo.customerNew,
                    storageFee: this.goodsTransferInfo.storageFee,
                    changeTime: this.goodsTransferInfo.changeTime,
                    remark: this.goodsTransferInfo.remark,
                    authenticateFlag: this.goodsTransferInfo.authenticateFlag ? 1 : 0,
                    containerNum: item.batchAttr07,
                    billOfLandingNo: item.batchAttr08,
                    matTypeCode: item.matTypCode,
                    matTypeName: item.matTypName,
                    matName: item.matName,
                    matCode: item.matCode,
                    productTime: item.dateGen,
                    invalidTime: item.dateExpire,
                    productStatus: item.productStatus,
                    qualityStatus: item.qualityStatus,
                    freezingMark: item.freezeFlag,
                    freezingReason: item.freezingReason,
                    totalWeight: item.orderWeight,
                    qtyNum: item.totalQty,
                    changeNum: item.availableQty,
                    changeWeight: item.availableWeight,
                    declarationNo: item.batchAttr12 ? item.batchAttr12 : '',
                    voyageNumber: item.batchAttr14 ? item.batchAttr14 : '',
                    voyageNumberName: item.batchAttr16 ? item.batchAttr16 : '',
                    inCarNo: item.inCarNo ? item.inCarNo : '',
                    batchNum: item.wmsBatchNum ? item.wmsBatchNum : '',
                    settlementCustomerCode: this.wmsCustomerCode,
                    settlementCustomer: item.settlementCustomerName,
                    dateInto: item.dateInto,
                    factoryCode: item.factoryCode,
                    country: item.countryName,
                    batchAttributeId: item.batchAttributeId
                })
            })
            if (this.item != null && this.item != undefined) {
                let body = [];
                this.tableDataList.forEach((item, index) => {
                    body.push({
                        dateInto: item.dateInto,
                        id: item.id,
                        whCode: this.wareList.filter(item => item.id == this.$props.menuActiveName)[0].whCode,
                        customerCode: this.cargoOwner.customerCode,
                        customer: this.cargoOwner.dictName,
                        settlementCustomerNew: this.goodsTransferInfo.settlementCustomerNew,
                        customerNew: this.goodsTransferInfo.customerNew,
                        storageFee: this.goodsTransferInfo.storageFee,
                        changeTime: this.$utils.timestampToDate(this.goodsTransferInfo.changeTime),
                        remark: this.goodsTransferInfo.remark,
                        authenticateFlag: this.goodsTransferInfo.authenticateFlag ? 1 : 0,
                        country: item.countryName,
                        containerNum: item.batchAttr07,
                        billOfLandingNo: item.batchAttr08,
                        batchAttributeId:item.batchAttributeId,//23.6.21 唐旭平要求添加
                        matTypeCode: item.matTypCode,
                        matTypeName: item.matTypName,
                        matName: item.matName,
                        matCode: item.matCode,
                        productTime: item.dateGen,
                        invalidTime: item.dateExpire,
                        productStatus: item.productStatus,
                        qualityStatus: item.qualityStatus,
                        freezingMark: item.freezeFlag,
                        freezingReason: item.freezingReason,
                        totalWeight: item.orderWeight,
                        qtyNum: item.totalQty,
                        changeNum: item.availableQty,
                        changeWeight: item.availableWeight,
                        declarationNo: item.batchAttr12 ? item.batchAttr12 : '',
                        voyageNumber: item.batchAttr14 ? item.batchAttr14 : '',
                        voyageNumberName: item.batchAttr16 ? item.batchAttr16 : '',
                        inCarNo: item.inCarNo ? item.inCarNo : '',
                        batchNum: item.wmsBatchNum ? item.wmsBatchNum : '',
                        settlementCustomerCode: this.wmsCustomerCode,
                        settlementCustomer: item.settlementCustomerName,
                        detailStr: this.selectInfo[index].detailStr ? this.selectInfo[index].detailStr : JSON.stringify(this.selectInfo[index]),
                        factoryCode: item.factoryCode
                    })
                })
                let bodyEdit = {
                    orderNum: this.item.changeOrderNum,
                    orders: body,
                    fileList: this.goodsTransferInfo.fileList,
                    status: this.item.status ? this.item.status : 0
                }
                if (item == 0) {
                    this.saveLoading = true;
                } else {
                    this.saveLoading = true
                }
                if (bodyEdit.fileList.length > 0) {
                    bodyEdit.fileList.forEach(item => {
                        item['createUser'] = this.$utils.getUserInfo().realName
                    })
                }
                try {
                    editProp(bodyEdit, this.$props.wmsUrl).then(({data}) => {
                        if (data.returnCode == 200) {
                            if (item == 1) {
                                let body = this.item.changeOrderNum
                                submitProp(body, this.wmsUrl).then(({data}) => {
                                    if (data.returnCode == 200) {
                                        this.saveLoading = false;
                                        this.$Message.success('操作成功');
                                        this.$router.push({
                                            name: 'inventoryInfo',
                                            query: {
                                                planNum: 3
                                            }
                                        })
                                        this.$emit('initData');
                                    }
                                })
                            } else {
                                this.$Message.success('保存成功');
                                this.$router.push({
                                    name: 'inventoryInfo',
                                    query: {
                                        planNum: 3
                                    }
                                })
                                this.$emit('initData');
                            }
                        } else {
                            this.saveLoading = false;
                            this.$Message.error(data.returnMsg)
                        }
                    }).finally(() => {
                        if (item == 0) {
                            this.saveLoading = false;
                        } else {
                            this.saveLoading = false;
                        }
                    })
                } catch {
                    this.saveLoading = false;
                }

            } else {
                if (body.list.length != 0) {
                    body.fileList = this.goodsTransferInfo.fileList
                    if (body.fileList && body.fileList.length > 0) {
                        body.fileList.forEach(item => {
                            item['createUser'] = this.$utils.getUserInfo().realName
                        })
                    }
                    if (item == 0) {
                        this.saveLoading = true;
                    } else {
                        this.saveLoading = true;
                    }
                    try {
                        addProp(body, this.$props.wmsUrl).then(({data}) => {
                            if (data.returnCode == 200) {
                                if (item == 1) {
                                    let body = data.returnData
                                    submitProp(body, this.wmsUrl).then(({data}) => {
                                        if (data.returnCode == 200) {
                                            this.$Message.success('操作成功');
                                            this.saveLoading = false;
                                            this.$router.push({
                                                name: 'inventoryInfo',
                                                query: {
                                                    planNum: 3
                                                }
                                            })
                                            this.$emit('initData');
                                        }
                                    })
                                } else {
                                    this.$Message.success('保存成功');
                                    this.$router.push({
                                        name: 'inventoryInfo',
                                        query: {
                                            planNum: 3
                                        }
                                    })
                                    this.$emit('initData');
                                }
                            } else {
                                this.saveLoading = false;
                                this.$Message.error(data.returnMsg)
                            }
                        }).finally(() => {
                            if (item == 0) {
                                this.saveLoading = false;
                            } else {
                                this.saveAndUpLoading = false;
                            }
                        })
                    } catch {
                        this.saveLoading = false;
                        this.saveAndUpLoading = false;
                    }

                } else {
                    this.$Message.warning('货转信息不能为空')
                }
            }
        },
        getGoodsTransfer(item) {
            let body = {
                batchAttr07: item.batchAttr07,
                batchAttr08: '',
                changeQty: item.availableQty,
                wmsBatchNum: item.wmsBatchNum
            }
            getGoodsTransfer(body, this.$props.wmsUrl).then(({data}) => {
                item.availableWeight = data.returnData
            })
        },
        selectCustomerInfoByDto() {
            let body = {
                filterList: [
                    {
                        filterKey: "whCode",
                        filterValue: ""
                    },
                    {
                        filterKey: 'ownerCode',
                        filterValue: this.$props.ccisCustomerCode
                    },
                    {
                        filterKey: 'supervisionStatus',
                        filterValue: '0'
                    }
                ],
                filterName: [],
                stkCodeList: [],
                pageNum: this.page,
                pageSize: this.pageSize,
                pageOptionsList: [
                    50,
                    100,
                    200
                ],
                searchKeyOrderType: null,
                sortList: [],
                searchKey: "",
                searchOwnerCode: this.wmsCustomerCode,
                searchWhCode: '',
                searchSettlementCustomer: '',
                searchManageCompanyCode: '',
                outPlanOrderNum: ""
            }
            getOwnerCodeListByStock(body, this.$props.wmsUrl).then(({data}) => {
                if (data.returnCode == 200) {
                    this.allOwner = data.returnData
                }
            })
        },
        getBusinessInfos() {
            getCategoryInfo(this.$props.wmsUrl).then(({data}) => {
                if (data.returnCode == 200) {
                    this.categoryList = data.returnData
                }
            })
        },
        Pagechange(page) {
            this.page = page,
            this.selectStockDataList('', page);
        },
        pageSizeChange(pageSize) {
            this.pageSize = pageSize
            this.selectStockDataList('', pageSize);
        },
        onIsShows() {
            this.$route.params.tableData = undefined
            this.$router.push({
                name: 'inventoryInfo'
            })
        },
        goodsInformation() {
            this.goodsTransferPlanInfoShow = false;
            this.tableDataList = _.cloneDeep(this.selectInfo)
            console.log(this.tableDataList);
            this.tableDataList.forEach((item) => {
                item.settlementCustomer = _.cloneDeep(this.goodsTransferInfo.settlementCustomerNew)
            })
            console.log(this.tableDataList);
        },
        godsInformationClose() {
            this.goodsTransferPlanInfoShow = false;
        },
        addHandler(index, rows) {
            console.log(index, rows);
            this.searchInfo.splice(index, 1);
            rows.orderWeight = _.cloneDeep(rows.availableWeight)
            this.selectInfo.push(rows)
            console.log(this.selectInfo);
            this.outQty = rows.totalQty;
        },
        selectInfoDelete(index, rows) {
            this.searchInfo.push(rows);
            this.selectInfo.splice(index, 1)
        },
        delectInfo(index, rows) {
            this.searchInfo.push(rows);
            this.selectInfo.splice(index, 1)
            this.tableDataList.splice(index, 1);
        },
        async selectStockDataList(event, page) {
            this.wmsCustomerCode = await this.selectWMSCustomerInfo();
            let body = {
                pageNum: this.page,
                pageSize: this.pageSize,
                pageOptionsList: [
                    50,
                    100,
                    200
                ],
                filterList: [{
                    filterKey: 'ownerCode',
                    filterValue: this.wmsCustomerCode
                },
                {
                    "filterKey": "supervisionStatus",
                    "filterValue": "0"
                }],
                sortList: [],
                searchKey: "",
                searchOwnerCode: this.wmsCustomerCode,
                notInMatTypeCodeList: [
                    "9999",
                    "0001"
                ],
                searchSettlementCustomer: ''
            }
            if (this.searchTableData.settlementCustomerName !== '') {
                    body.searchSettlementCustomer =  this.searchTableData.settlementCustomerName
            }
            if (this.searchTableData.batchAttr07 !== '') {
                body.filterList.push({filterKey: 'batchAttr07', filterValue: this.searchTableData.batchAttr07})
            }
            if (this.searchTableData.country) {
                body.filterList.push({filterKey: 'country', filterValue: this.searchTableData.country})
                // body.countryList = [this.searchTableData.country]
            }
            if (this.searchTableData.factoryCode) {
                body.filterList.push({filterKey: 'factoryCode', filterValue: this.searchTableData.factoryCode})
            }
            if (this.searchTableData.filterValue !== '') {
                body.filterList.push({filterKey: 'filterValue', filterValue: this.searchTableData.filterValue})
            }
            if (this.searchTableData.stgTypCode !== '') {
                body.filterList.push({filterKey: 'stgTypCode', filterValue: this.searchTableData.stgTypCode})
            }
            if (this.searchTableData.matName !== '') {
                body.filterList.push({filterKey: 'matName', filterValue: this.searchTableData.matName})
            }
            if (this.searchTableData.matTypCode !== '') {
                body.filterList.push({filterKey: 'matTypCode', filterValue: this.searchTableData.matTypCode})
            }
            if (this.searchTableData.batchAttr08 !== '') {
                body.filterList.push({filterKey: 'batchAttr08', filterValue: this.searchTableData.batchAttr08})
            }
            if (this.searchTableData.mscAuthentication !== '') {
                body.filterList.push({
                    filterKey: 'mscAuthentication',
                    filterValue: this.searchTableData.mscAuthentication
                })
            }
            if (this.searchTableData.goodsBondedProperty !== '') {
                body.filterList.push({
                    filterKey: 'goodsBondedProperty',
                    filterValue: this.searchTableData.goodsBondedProperty
                })
            }
            if (this.searchTableData.supervisionStatus !== '') {
                body.filterList.push({
                    filterKey: 'supervisionStatus',
                    filterValue: this.searchTableData.supervisionStatus
                })
            }
            if (this.searchTableData.wmsBatchNum !== '') {
                body.filterList.push({filterKey: 'wmsBatchNum', filterValue: this.searchTableData.wmsBatchNum})
            }
            if (this.searchTableData.productStatus !== '') {
                body.filterList.push({filterKey: 'productStatus', filterValue: this.searchTableData.productStatus})
            }
            if (this.searchTableData.dateInto.length > 0 && this.searchTableData.dateInto[0] !== '') {
                body.filterList.push({
                    filterKey: 'dateIntoStartDate',
                    filterValue: this.$utils.timestampToDate(this.searchTableData.dateInto[0])
                })
                body.filterList.push({
                    filterKey: 'dateIntoEndDate',
                    filterValue: this.$utils.timestampToDate(this.searchTableData.dateInto[1])
                })
            }
            if (this.searchTableData.dateGen !== '') {
                let data = new Date(this.searchTableData.dateGen);
                let dateGen = data.getTime()
                if (this.menuActiveName == 36) {
                    dateGen = this.$utils.timestampToDate(dateGen);
                }
                body.filterList.push({filterKey: 'dateGen', filterValue: dateGen})
            }
            if (this.searchTableData.dateExpire !== '') {
                let data = new Date(this.searchTableData.dateExpire);
                let dateExpire = data.getTime()
                if (this.menuActiveName == 36) {
                    dateExpire = this.$utils.timestampToDate(dateExpire);
                }
                body.filterList.push({filterKey: 'dateExpire', filterValue: dateExpire})
            }
            if (page == '' || page == null || page == undefined || page == 'date') {
                if (body.filterList.length > 2 || body.searchSettlementCustomer != '') {
                    this.page = 1;
                    body.pageNum = 1;
                }
            }
          body.stockQueryType = 'transfer'
          getStockListByOwnerCodeForLenglian(body, this.$props.wmsUrl).then(({data}) => {
                this.total = data.returnData.pageInfo.total
                this.searchInfo = data.returnData.pageInfo.list
                this.selectInfo.forEach(item => {
                    this.searchInfo = this.searchInfo.filter(items => item.filterUniqueCode != items.filterUniqueCode)
                })
                this.searchInfo.forEach((item) => {
                    item.dateInto = this.$utils.timestampToDate(item.dateInto);
                })
                this.searchInfo.forEach((item) => {
                    item.dateGen = this.$utils.timestampToDate(item.dateGen);
                })
                this.searchInfo.forEach((item) => {
                    item.dateExpire = this.$utils.timestampToDate(item.dateExpire);
                })
            })
            getAllStgData(this.$props.wmsUrl).then(({data}) => {
                this.allStgData = data.returnData
            })
        },
        deleteRow(index) {
            this.tableDataList.splice(index, 1);
        },
        getInfoName() {
            baseCodeApi.getContractDictData().then(({data}) => {
                if (data.returnCode === 200) {
                    const {platformWarehouseList, customerList} = data.returnData;
                    this.dictInfo.whCode = platformWarehouseList.map(i => {
                        return {
                            dictName: i.whName,
                            dictValue: i.id
                        };
                    });
                    this.dictInfo.customerId = customerList.map(i => {
                        return {
                            dictName: i.customerName,
                            dictValue: i.id,
                            customerCode: i.customerCode
                        };
                    });
                    if (this.$route.params.menuActiveName) {
                        this.goodsTransferInfo.whName = this.wareList.filter(item => item.id == this.$route.params.menuActiveName)[0].whName
                    } else {
                        this.goodsTransferInfo.whName = this.wareList.filter(item => item.id == this.$props.menuActiveName)[0].whName
                    }
                    // this.settlementCustomer = this.cargoOwner.dictName
                } else {
                    this.$Message.error(data.returnMsg);
                }
            }).catch(err => {
                console.log(err);
            });
        },
        checkData() {
            this.selectRow = this.goodsTransferInfo;
            this.$refs.attachmentRef.showUpload();
        },
        refreshFileList(row, fileList) {
            this.goodsTransferInfo.fileList = fileList;
        },

        async onChangeCustomer(value) {
            this.tableDataList = [];
            const customer = this.$utils.getUserInfo().customerInfoList.find(i => i.customerPartyCode === value);
            this.cargoOwner = {
                dictName: customer.customerPartyName,
                dictValue: customer.customerPartyID,
                customerCode: customer.customerPartyCode
            };
            this.wmsCustomerCode = await this.selectWMSCustomerInfo();
            this.selectCustomerInfoByDto();
        }
    },
    async mounted() {
        this.goodsBondedPropertyList = [
                {label: '一般贸易', value: 1},
                {label: '保税', value: 2}
            ],
        this.supervisionStatusList = [
            {label: '已质押', value: 1},
            {label: '未质押', value: 0}
        ],
        this.$props.menuActiveName = JSON.parse(this.$route.query.menuActiveName);
        this.$props.wareList = JSON.parse(this.$route.query.wareList);
        this.$props.wmsUrl = JSON.parse(this.$route.query.wmsUrl);
        if (this.$route.query.item) {
            this.$props.item = JSON.parse(this.$route.query.item);
            this.$props.list = JSON.parse(this.$route.query.list);
        }
        if (this.$route.query.tableData) {
            this.tableDataHZ = _.cloneDeep(JSON.parse(this.$route.query.tableData))
        }
        this.$props.ccisCustomerCode = JSON.parse(this.$route.query.ccisCustomerCode);

        if (!this.$props.wmsUrl) {
            this.$props.wmsUrl = this.wareList.filter(item => item.id == this.$route.params.menuActiveName)[0].ipProt;
        }

        await this.complete;
        if (this.$store.state.user.userInfo.customerInfoList.length === 1) {
            this.cargoOwner = {
                    dictName: this.$store.state.user.userInfo.customerInfoList[0].customerPartyName,
                    dictValue: this.$store.state.user.userInfo.customerInfoList[0].customerPartyID,
                    customerCode: this.$store.state.user.userInfo.customerInfoList[0].customerPartyCode
                };
            this.goodsTransferInfo.customer = this.cargoOwner.dictName;
        }
        if (this.item && this.item.ccisCustomerCode) {
            this.cargoOwner = {
                dictName: this.item.customer,
                dictValue: null,
                customerCode: this.item.ccisCustomerCode
            };
            this.goodsTransferInfo.customer = this.cargoOwner.dictName;
        }
        if (this.goodsTransferInfo.customer) {
            this.wmsCustomerCode = await this.selectWMSCustomerInfo();
            this.selectCustomerInfoByDto();
        }

        if (this.item) {
            this.goodsTransferInfo.customerNew = this.item.customerNew
                this.goodsTransferInfo.authenticateFlag = this.item.authenticateFlag
            this.$nextTick(() => {
                if (this.goodsTransferInfo.authenticateFlag == 0) {
                    this.goodsTransferInfo.authenticateFlag = false
                } else {
                    this.goodsTransferInfo.authenticateFlag = true
                }
            })
            this.goodsTransferInfo.remark = this.item.remark,
                this.goodsTransferInfo.changeTime = this.$utils.timestampToDate(this.item.changeTime),
                this.goodsTransferInfo.storageFee = this.item.storageFee,
                this.goodsTransferInfo.settlementCustomerNew = this.item.settlementCustomerNew
            if (this.item.list) {
                this.item.list.forEach((items) => {
                    items.dateInto = this.$utils.timestampToDate(items.dateInto)
                    items.productTime = this.$utils.timestampToDate(items.productTime)
                    items.invalidTime = this.$utils.timestampToDate(items.invalidTime)
                    if (this.menuActiveName == 36) {
                        this.tableDataList.push({
                            dateInto: items.dateInto,
                            id: items.id,
                            batchAttr07: items.containerNum,
                            settlementCustomerName: items.settlementCustomer,
                            settlementCustomer: items.settlementCustomer,
                            matCode: items.matCode,
                            matName: items.matName,
                            // matTypName: items.matCode,
                            batchAttr08: items.billOfLandingNo,
                            dateGen: items.productTime,
                            dateExpire: items.invalidTime,
                            matTypName: items.matTypeName != null ? items.matTypeName :items.matTypeCode,
                            productStatus: items.productStatus,
                            qualityStatus: items.qualityStatus,
                            freezeFlag: items.freezingMark,
                            freezingReason: items.freezingReason,
                            sumMatWeight: items.totalWeight,
                            totalQty: items.qtyNum,
                            availableQty: items.changeNum,
                            orderWeight: items.totalWeight,
                            storageFee: items.storageFee,
                            detailStr: items.detailStr,
                            availableWeight: items.changeWeight,
                            batchAttr12: items.declarationNo,
                            wmsBatchNum: items.batchNum,
                            batchAttr14: items.voyageNumber,
                            batchAttr16: items.voyageNumberName,
                            matTypCode: items.matTypeCode,
                            countryName: items.country,
                            factoryCode: items.factoryCode
                        })
                    } else {
                        this.tableDataList.push({
                            dateInto: items.dateInto,
                            id: items.id,
                            batchAttributeId:items.batchAttributeId,
                            batchAttr07: items.containerNum,
                            settlementCustomerName: items.settlementCustomer,
                            settlementCustomer: items.settlementCustomer,
                            matName: items.matName,
                            // matTypName: items.matCode,
                            batchAttr08: items.billOfLandingNo,
                            dateGen: items.productTime,
                            dateExpire: items.invalidTime,
                            matTypName: items.matTypeName != null    ? items.matTypeName :items.matTypeCode,
                            productStatus: items.productStatus,
                            qualityStatus: items.qualityStatus,
                            freezeFlag: items.freezingMark,
                            freezingReason: items.freezingReason,
                            sumMatWeight: items.totalWeight,
                            totalQty: items.qtyNum,
                            availableQty: items.changeNum,
                            orderWeight: items.totalWeight,
                            storageFee: items.storageFee,
                            detailStr: items.detailStr,
                            availableWeight: items.changeWeight,
                            batchAttr12: items.declarationNo,
                            wmsBatchNum: items.batchNum,
                            batchAttr14: items.voyageNumber,
                            batchAttr16: items.voyageNumberName,
                            matTypCode: items.matTypeCode,
                            country: items.country,
                            factoryCode: items.factoryCode
                        })
                    }
                    console.log(this.tableDataList)
                    this.selectInfo = _.cloneDeep(this.tableDataList)
                })
            }
            this.goodsTransferInfo.fileList = this.item.fileList;
            this.selectRow = {
                fileList: this.item.fileList
            };
        }
        if (this.$route.query.tableData) {
            let tableDataHZNew = [];
            if (this.tableDataHZ != undefined) {
                this.tableDataHZ.forEach((item) => {
                    item.dateInto = this.$utils.timestampToDate(item.dateInto)
                    item.dateGen = this.$utils.timestampToDate(item.dateGen)
                    item.dateExpire = this.$utils.timestampToDate(item.dateExpire)
                    item['matTypName'] = item.matTypName
                    item['settlementCustomer'] = item.settlementCustomerName
                    item['freezeFlag'] = item.indBlkRmU
                    item['settlementCustomer'] = ''
                    item.availableWeight = item.orderWeight
                    if (item.freezeFlag == '0') {
                        item.freezeFlag = '未冻结'
                    } else {
                        item.freezeFlag = '已冻结'
                    }
                    if (item.availableQty > 0) {
                        tableDataHZNew.push(item)
                    }
                    this.getGoodsTransfer(item)
                })
                this.tableDataList = tableDataHZNew
                this.selectInfo = _.cloneDeep(this.tableDataList)
            }
        }
        if (this.$route.params.traceNum == 27) {
            this.tableData.cloumns = this.tableData.tableDataListColumnsTC
        }
        if (this.menuActiveName == 26 || this.menuActiveName == 37) {
            this.tableData.tableDataListColumns = this.tableData.tableDataListColumnsTJ
        } else if(this.menuActiveName == 36) {
            this.tableData.tableDataListColumns = this.tableData.tableDataListColumnsSH
        } else {
            this.tableData.tableDataListColumns = this.tableData.tableDataListColumnsTC
        }
        this.getInfoName()
        // this.selectStockDataList()
        this.getBusinessInfos()
        // this.selectCustomerInfoByDto();
    },
    watch: {
        '$store.state.user.userInfo': {
            async handler(value) {
                if (!value || !value.entrustingPartyCode) return;
                this.resolveComplete();
            },
            deep: true,
            immediate: true
        }
    }
}
</script>

<style>

</style>
